package com.abc20230319.demo;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyFilterConfig {
    @Bean
    public FilterRegistrationBean<GetFilter> getFilterFilterRegistrationBean() {
        FilterRegistrationBean<GetFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(new GetFilter());
        bean.setName("getFilter"); //最下面的链接指出首字母要小写
        bean.addUrlPatterns("/back/get");
//        bean.addInitParameter("excludeUrls", "/web/login");
//        bean.setOrder(0);
        return bean;
    }

    @Bean
    public FilterRegistrationBean<PostFilter> postFilterFilterRegistrationBean() {
        FilterRegistrationBean<PostFilter> bean = new FilterRegistrationBean<>();
        bean.setFilter(new PostFilter());
        bean.setName("postFilter"); //最下面的链接指出首字母要小写
        bean.addUrlPatterns("/back/post");
//        bean.addInitParameter("excludeUrls", "/web/login");
//        bean.setOrder(0);
        return bean;
    }
}
